home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 April
/
Macworld (1999-04).dmg
/
Serious Software
/
SiteCam 3.0 demo
/
Extras
/
Sample AppleScripts
/
FTP Scripts
/
PPP Anarchie sample
< prev
next >
Wrap
Text File
|
1997-11-11
|
4KB
|
108 lines
-- This is a SiteCam post-process script to FTP the last image
-- (Image.jpg) to a remote FTP location and saves it as "current.jpg".
-- This document should be viewed and edited using "Script Editor".
-- This script starts and terminates a PPP connection if not already
-- connected
-- The FTP portion of the script uses a two step process to minimize
-- the time that a image is unavailable to the http server.
-- Step 1: Get the right PPP
-- Verify that you have the latest Apple PPP
-- Install and make sure that "PPP Commands" is in your
-- "System Folder:Extensions:Scripting Additions" folder.
-- To test your PPP, create a new script and type "PPP Connect"
-- and hit "Run."
-- If you're already connected, you'll get an error. Next, delete
-- that and type "PPP Disconnect" and hit "Run."
--
-- If your Fetch program is not named "Fetch", either rename it
-- or change the script to its actual file name (e.g. Fetch 3.0)
--
-- Step 2:
-- Open this document from ScriptEditor- save it as "MyFTP Script"
-- Create a Ram Disk for added efficiency using the "Memory" control
-- panel. (Or rename file path to suit your needs)
-- Put an alias of Fetch 3.0.1 in your "Startup Items" folder in your
-- System Folder. If you have an older version, please upgrade.
-- Reboot to activate Ram Disk and start Fetch.
-- Edit the script below, modifying the host, userID, password, and
-- file names as needed. They have been marked with xxxxxx
-- Step 3:
-- Create a SiteCam document with the following settings
-- Set type to jpeg (already default)
-- Set number of pictures to save to 1
-- Set image destination folder to your Ram Disk
-- set file name to Image
-- Do not set your post process proc yet.
-- Save your SiteCam document in your System Folder:Startup items folder.
-- Do a command-T (take picture now) to take the first picture.
-- Next: Go to this script editor document and try running the script.
-- If all goes well, current.jpg should exist on your remote FTP server.
-- Debug as needed. When working, Quit Script Editor or close
-- "MyFTP Script".
-- From SiteCam, Set Post process script to this document to
-- "MyFTP Script"
with timeout of 1000 seconds
try
-- Find status of PPP connection and store in a variable "origState"
set origState to PPP status
-- If not connected, connect to your ISP
if (state of origState is not "Connected") then
PPP connect
end if
-- If we're connected, do the FTP part
if (state of (PPP status) is "Connected") then
-- FTP the last image to a remote location.
-- This script uses a two step process to minimize the time that a image
-- is unavailable to the http server.
-- Get the name of the last image saved
tell application "SiteCam"
set yourLocalImage to last image file of active document
end tell
-- Change the variables below, and add passwords, if needed.
tell application "Anarchie"
set ftptempfile to "/yourpath/temp.jpg"
set ftpdestfile to "/yourpath/current.jpg"
set yourFTPHost to "ftp.yourhost.com"
with timeout of 1000 seconds
store file yourLocalImage host yourFTPHost path ftptempfile
rename host yourFTPHost path ftptempfile newname ftpdestfile
end timeout
end tell
else
-- signal FTP error
-- change this to some error, or take out beep if it bugs you.
beep
beep
end if
PPP disconnect
on error errMsg number errNum
-- signal PPP or other error
-- change this to some error, or take out beep if it bugs you.
beep
end try
end timeout